package com.ssy.lingxi.pay.service;

import com.ssy.lingxi.pay.api.dto.request.*;
import com.ssy.lingxi.pay.model.assetAccount.*;
import com.ssy.lingxi.pay.model.dto.UrlLinkDTO;

import javax.servlet.http.HttpServletRequest;

/**
 * 微信支付接口定义
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/10/21
 */
public interface IWeChatPayService {

    /**
     * 统一下单接口(native)
     */
    PayResult nativePay(MobilePayRequest mobilePayRequest, HttpServletRequest request);

    /**
     * 统一下单接口(app)
     */
    PayResult appPay(MobilePayRequest mobilePayRequest, HttpServletRequest request);

    /**
     * JSAPI支付(小程序调起微信支付)
     */
    PayResult jsAPIPay(MobilePayRequest mobilePayRequest, HttpServletRequest request);

    /**
     * H5支付(微信)
     */
    PayResult h5Pay(MobilePayRequest mobilePayRequest, HttpServletRequest request);

    /**
     * 统一下单接口(app)
     */
    PayResult appPay_new(MobilePayRequest mobilePayRequest, HttpServletRequest request);

    /**
     * 查询订单
     */
    PayResult orderQuery(WeChatOrderQueryRequest weChatOrderQueryRequest);

    /**
     * 关闭订单
     */
    PayResult closeOrder(WeChatCloseOrderRequest weChatCloseOrderRequest);

    /**
     * 申请退款
     */
    PayResult refund(WeChatRefundRequest weChatRefundRequest);

    /**
     * 退款查询
     */
    PayResult refundQuery(WeChatRefundQueryRequest weChatRefundQueryRequest);

    /**
     * 获取微信AccessToken
     * @param accessTokenRequest
     * @return
     */
    AccessToken getWeChatAccessToken(AccessTokenRequest accessTokenRequest);

    /**
     * 获取微信JsApiTicket
     *
     * @param accessTokenRequest
     * @return
     */
    JsApiTicket getJsApiTicket(AccessTokenRequest accessTokenRequest);

    /**
     * 获取JS-SDK签名
     * @param jsApiRequest
     * @return
     */
    JsApiResult getJsApiResult(JsApiRequest jsApiRequest);

    /**
     * 先获取微信AccessToken,根据AccessToken获取url_link
     *
     * @return url_link
     */
    String getUrlLink(UrlLinkDTO urlLinkDTO);
}
